package com.itheima.controller;

import com.itheima.Service.ReportService;
import com.itheima.pojo.PetBranchOption;
import com.itheima.pojo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 统计物种个数
     * @return
     */
    @GetMapping("/petSpeciesData")
    public Result countPetSpecies(){
        List<Map> petSpecies = reportService.countPetSpecies();
        return Result.success(petSpecies);
    }

    @GetMapping("petStateData")
    public Result countPetState(){
        List<Map> petState = reportService.countPetState();
        return Result.success(petState);
    }

    @GetMapping("/empStoreData")
    public Result empStoreData(){
        PetBranchOption petBranchList = reportService.countStoreData();
        return Result.success(petBranchList);
    }
}
